Attribute VB_Name = "CreateNewMacros"

Sub ColorfulScript()
'
' ColorfulScript Macro
'
Dim pg As Paragraph, r As Range
    For Each pg In ActiveDocument.Paragraphs
        pgtext = pg.Range.Text
        
        If InStr(1, pgtext, "【角色1】") <> 0 Then  '如果找到类的匹配项
            'pg.Range.Font.Size = 20
            'pg.Range.Bold = True
            pg.Range.Font.Color = RGB(192, 0, 0)
        End If
        
        If InStr(1, pgtext, "【角色2】") <> 0 Then  '如果找到类的匹配项
            'pg.Range.Font.Size = 20
            'pg.Range.Bold = True
            pg.Range.Font.Color = RGB(68, 114, 196)
        End If
        
        If InStr(1, pgtext, "【角色3】") <> 0 Then  '如果找到类的匹配项
            'pg.Range.Font.Size = 20
            'pg.Range.Bold = True
            pg.Range.Font.Color = RGB(56, 87, 36)
        End If
        
    Next
    
Dim ifBrackets As Boolean
ifBrackets = False

For Each wd In ActiveDocument.Words
    If (wd = "【") Then
        ifBrackets = True
    End If
    If (wd = "】") Then
        ifBrackets = False
        wd.Font.Color = 1
    End If
    If (ifBrackets) Then
        wd.Font.Color = 1
    End If

Next


End Sub
